package com.example.source;

import com.example.beans.SensorReading;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.source.SourceFunction;

import java.util.HashMap;
import java.util.Random;

/**
 * * @projectName myflinkstu
 * * @title     SourceTest4_UDF
 * * @package    com.example.source
 * * @description
 * * @author hjx
 * * @date   2022-3-17 17:01
 * * @version V1.0.0
 * * @copyright 2022 ty
 */
public class SourceTest4_UDF {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        // 从文件读取数据
        DataStream<SensorReading> dataStream = env.addSource(new SensorSource());
        // 打印输出
        dataStream.print();
        env.execute();
    }
}

